import 'dart:convert' show json;

import 'package:flutter_elf/model/gank_io_girl_response.dart';
import 'package:flutter_elf/model/home_list.dart';
import 'package:flutter_elf/model/tv_live_rsp.dart';
import 'package:flutter_elf/model/user.dart';


class EntityFactory<T> {
  static T generateOBJ<T>(jsonRes) {
    T t;
    switch (T.toString()) {
      case 'User':
        t = User.fromJson(jsonRes) as T;
        break;
      case 'GankIOGirlResponse':
        t = GankIOGirlResponse.fromJson(jsonRes) as T;
        break;
      case 'TvLiveRsp':
        t = TvLiveRsp.fromJson(jsonRes) as T;
        break;
      case 'HomeListResponse':
        //首页数据
        t = HomeListResponse.fromJson(jsonRes) as T;
        break;
    }
    return t;
  }
}
